{% extends "tcms_base.html" %}
{% load comments %}
{% load static %}
{% load report_tags %}
{% block subtitle %}TestCaseRuns{% endblock %}
{% block custom_stylesheet %}
<link rel="stylesheet" type="text/css" href="{% static 'style/print.css' %}" media="print" />
{% endblock %}

{% block custom_javascript %}
<script type="text/javascript" src="{% static 'js/report.js' %}"></script>
{% endblock %}

{% block contents %}
<div id="content">
	{% if form_errors %}
	<div>{{ form_errors }}</div>
	{% else %}
	<div>
		<h3>caseruns - {{ test_case_runs_count }}</h3>
		<table class="list" id="id_table_cases" cellspacing="0" cellspan="0">
			<thead>
				<tr>
					<th class="widthID">Case Run ID</th>
					<th class="widthID">Case ID</th>
					<th>Summary</th>
					<th width="80">Tester</th>
					<th width="80">Assignee</th>
					<th width="150">Automated </th>
					<th width="100">Category</th>
					<th width="60">Priority</th>
					<th width="50" style='text-align:center'>Status</th>
					<th width="40">Sort</th>
				</tr>
			</thead>
			<tbody>
				{% for test_case_run, status_name, priority_value, tester, assignee in test_case_runs %}
				<tr class="{% cycle 'odd' 'even' %} {% ifequal assignee.0 user.pk %} mine {%endifequal%}">
					<td>
						<a target="_blank" href="{% url "testruns-get" test_case_run.run.pk %}#caserun_{{ test_case_run.pk }}">#{{ test_case_run.pk }}</a>
					</td>
					<td "{{ test_case_run.case_id }}" class="case_title expandable">
						<a href="{% url 'testcases-get' test_case_run.case_id %}?from_plan={{ test_case_run.run.plan_id }}">{{ test_case_run.case_id }}</a>
					</td>
					<td>
						<a id="link_{{ forloop.counter }}" target="_blank" href="{% url 'testruns-get' test_case_run.run.pk %}?#caserun_{{ test_case_run.pk }}" title="Expand test case">{{ test_case_run.case.summary }}</a>
					</td>
					<td>
						{% if tester.1 %}
						<a target="_blank" href="{% url "tcms-profile" tester.1 %}" class="link_tested_by">{{ tester.1 }}</a>
						{% else %}None{% endif %}
					</td>
					<td>
						{% if assignee.1 %}
						<a href="{% url "tcms-profile" assignee.1 %}" class="link_assignee">{{ assignee.1 }}</a>
						{% else %}None{% endif %}
					</td>
					<td>{{ test_case_run.case.get_is_automated_status }}</td>
					<td>{{ test_case_run.case.category }}</td>
					<td>{{ priority_value }}</td>
					<td class="expandable center">
						<img border="0" alt="" class="icon_status btn_{{ status_name.lower }}" />
					</td>
					<td>
						<span class="mark">{{ test_case_run.sortkey }}</span>
					</td>
				</tr>
				{% empty %}
				<tr>
					<td colspan="10" align="center">No case run found</td>
				</tr>
				{% endfor %}
			</tbody>
		</table>
	</div>
	{% endif %}
</div>
{% endblock %}
